package cn.wolfcode.crm.mapper;

import cn.wolfcode.crm.domain.Employee;
import cn.wolfcode.crm.query.QueryObject;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface EmployeeMapper {

    int insert(Employee record);

    Employee selectByPrimaryKey(Long id);

    List<Employee> selectAll();

    int updateByPrimaryKey(Employee record);

    List<Employee> queryList(QueryObject qo);

    int queryCount(QueryObject qo);

    Employee selectByUsername(String username);

    /**
     * 根据id 改变其状态
     * @param id
     */
    void changeState(Long id);

    void resetPassword(Long id);

    /**
     * 打破外键表关系
     * @param employeeId 员工ID
     */
    void deleteRoleRelation(Long employeeId);

    /**
     * 维护外键表关系
     * @param employeeId 员工ID
     * @param roleId 角色ID
     */
    void insertRoleRelation(@Param("employeeId") Long employeeId,
                            @Param("roleId") Long roleId);

    List<Employee> selectTeacher();
}